//
//  WXXPageController.h
//  WanxxPageController
//
//  Created by myApple on 16/5/26.
//  Copyright © 2016年 myApple. All rights reserved.
//

#import <UIKit/UIKit.h>

@class WXXPageController;

@protocol WXXPageControllerDataSource <NSObject>

-(NSInteger)numberOfControllersInPageController;

-(UIViewController *)pagerController:(WXXPageController *)pagerController controllerForIndex:(NSInteger)index;

@optional
-(NSString *)pagerController:(WXXPageController *)pagerController titleForIndex:(NSInteger)index;

@end

@protocol WXXPageControllerDelegate <NSObject>

@optional

-(void)pagerController:(WXXPageController *)pagerController transitionFromIndex:(NSInteger)formIndex toIndex:(NSInteger)toIndex animated:(BOOL)animated;

-(void)pagerController:(WXXPageController *)pagerController transitionFromIndex:(NSInteger)formIndex toIndex:(NSInteger)toIndex progress:(CGFloat)progress;

@end

@interface WXXPageController : UIViewController

@property(nonatomic,strong,readonly)UIScrollView * contentView;

@property(nonatomic,weak)id<WXXPageControllerDataSource>dataSource;
@property(nonatomic,weak)id<WXXPageControllerDelegate>delegate;

@property(nonatomic,assign,readonly)NSInteger curIndex;
@property(nonatomic,assign,readonly)NSRange visibleRange;
@property(nonatomic,assign)CGFloat contentTopEdging;
@property(nonatomic,assign)BOOL adjustStatusBarHeight;
@property(nonatomic,assign)CGFloat changeIndexWhenScrollProgress;
-(void)reloadData;
-(void)updateContentView;
-(void)moveToControllerAtIndex:(NSInteger)index animated:(BOOL)animated;
-(NSArray *)visibleViewControllers;
-(BOOL)isProgressScrollEnable;
-(NSInteger)statusBarHeight;

@end

@interface WXXPageController (TransitionOverride)

// subclass override
- (void)transitionFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex animated:(BOOL)animated;

- (void)transitionFromIndex:(NSInteger)fromIndex toIndex:(NSInteger)toIndex progress:(CGFloat)progress;

@end
